﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Sahibinden.UserControl;
using System.Data.SqlClient;
using System.Data;
using Business.Dal;

namespace Sahibinden.UserAction
{
    public partial class IlanAra2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnAra_Click(object sender, EventArgs e)
        {
            SqlCommand cmd = new SqlCommand();
            string SqlText = "Select * from Ilanlar Where KategoriID Like @KategoriID";
            cmd.Parameters.Add("@KategoriID", SqlDbType.VarChar).Value = Categories.CategoryID + "%";

            IlanProvider ip = new IlanProvider();
            GridView1.DataSource=  ip.GetIlanAra(SqlText, cmd);
            GridView1.DataBind();
        }

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Sec")
            {
                Response.Redirect("IlaniListele.aspx?IlanID="+e.CommandArgument.ToString());
            }
        }
    }
}
